#include "../include/gudb.h"
#include "../src/parser/sql_parser.h"
#include <stdio.h>
#include <stdlib.h>

int main() {
    printf("Debug DROP token parsing\n");
    printf("=========================\n\n");
    
    const char* sql = "ALTER TABLE products DROP COLUMN category";
    printf("SQL: %s\n", sql);
    
    parser_t* parser = parser_create(sql);
    if (!parser) {
        printf("Failed to create parser\n");
        return 1;
    }
    
    printf("Initial current_token: type=%d, value=%s\n", 
           parser->current_token ? parser->current_token->type : -1,
           parser->current_token && parser->current_token->value ? parser->current_token->value : "NULL");
    
    // Manually step through tokens
    token_t* token;
    int count = 0;
    
    while ((token = lexer_peek_token(parser->lexer)) && token->type != TOKEN_EOF && count < 10) {
        printf("Token %d: type=%d, value=%s\n", count, token->type, token->value ? token->value : "NULL");
        token_destroy(token);
        
        // Advance to next token
        token_destroy(parser->current_token);
        parser->current_token = lexer_next_token(parser->lexer);
        count++;
    }
    
    parser_destroy(parser);
    return 0;
}